package config

import (
	"fmt"

	"gitverse.ru/dlc/similarity-compiler/pkg/env"
)

type Config struct {
	GRPC    GRPC
	Service Service
}

func Initialize() (*Config, error) {
	env, err := env.Parse[ENV](".env")
	if err != nil {
		return nil, fmt.Errorf("parse env: %w", err)
	}

	return &Config{
		GRPC: GRPC{
			Port: env.GRPC.Port,
		},

		Service: Service{
			Compilers: Compilers{
				LuaJitBinary: env.Compilers.LuaJitBinary,
			},
		},
	}, nil
}
